<?php
	echo $this -> Html -> script(array('mimage.js'));
?>
<div id="mainContent">
<?php
	echo $this -> Form -> create('Image', array('id' => 'frmMain', 'url' => 'update', 'data-ajax' => 'false'));
?>
    <!--  start content-table-inner -->
	<div id="content-table-inner">
        <p>
        	<input type="button" value="Thêm hình ảnh mới" onclick="location.href='<?php echo $this -> Html -> url('/',true); ?>mimage/insert'" />
        	<input type="button" id="btnChangeOrder" value="Sắp xếp nhóm" onclick="ChangeOrder()" />
        </p>
        <br />
        <table id="product-table" border="0" width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <th><a>Chủ đề</a></th>
                <th><a>Thứ tự</a></th>
                <th><a>Trạng thái</a></th>
                <th>&nbsp</th>
            </tr>
            <?php 
	            foreach ($imageList as $image) {
	                echo "<tr>";
	                    echo "<td>".$image['Image']['title']."</td>";
	                    echo "<td><input type='text' class='orderindex' value=".$image['Image']['order']." itemId=".$image['Image']['id']." readonly='true' /></td>";
	                    if($image['Image']['status'] == '1') {
	                    	echo "<td>Bật</td>";
	                    } else {
	                    	echo "<td>Tắt</td>";
	                    }
	                    echo "<td>";
	                        echo "<input type='button' value='Sửa' onclick='Update(".$image['Image']['id'].")' />";
	                        echo " <input type='button' value='Xóa' onclick='Delete(".$image['Image']['id'].")' />";
	                    echo "</td>";
                	echo "</tr>";
            	}
            ?>
        </table>
    </div>
<?php echo $this -> Form -> end(); ?>
</div>